---
layout: docs
page_title: nomad var get reference
description: |-
  The `nomad var get` command retrieves the variable at the given path from
  Nomad.
---

# `nomad var get` command reference

The `var get` command is used to get the contents of an existing [variable][].

## Usage

```plaintext
nomad var get [options] <path>
```

If ACLs are enabled, this command requires a token with the `variables:read`
capability for the target variable's namespace and path. See the [ACL policy][]
documentation for details.

## Options

- `-item` `(string: "")`: Print only the value of the given item. Specifying
   this option will take precedence over other formatting directives. The result
   will not have a trailing newline making it ideal for piping to other
   processes.

- `-out` `(enum: go-template | hcl | json | none | table )`: Format to render the
  variable in. When using "go-template", you must provide the template content
  with the `-template` option. Defaults to "table" when stdout is a terminal and
  to "json" when stdout is redirected.

- `-template` `(string: "")` Template to render output with. Required when
  output is "go-template".

- `-ui`: Open the variable page in the browser.

## Examples

Retrieve the variable stored at path "secret/creds":

```shell-session
$ nomad var get secret/creds
Namespace   = default
Path        = secret/creds
Create Time = 2022-08-23T11:14:37-04:00
Check Index = 116

Items
passcode = my-long-passcode
```

Return only the "passcode" item from the variable stored at "secret/creds":

```shell-session
$ nomad var get -item=passcode secret/creds
my-long-passcode
```

## General options

@include 'general_options.mdx'

[variable]: /nomad/docs/concepts/variables
[ACL Policy]: /nomad/docs/other-specifications/acl-policy#variables
